import React from 'react';
import {  notification, } from 'antd';

interface InfoProps {
  type:'success' | 'info' | 'warning' | 'error';
  title:string,
  content:string,
  onOpen:()=>void
}
// type NotificationType = {'success' | 'info' | 'warning' | 'error';}
const Notification: React.FC<InfoProps> = ({title,content,type,onOpen}) => {
  const [api] = notification.useNotification();

  const handleClick = () => {
    if(onOpen){
      onOpen()
    }
    api[type]({
      message: title,
      description:content
    });
  };

  return (
    <>
      {/* {contextHolder} */}
    </>
  );
};

export default Notification;